ref(opentelemetry): Remove enhanceDscWithOpenTelemetryRootSpanName - #22797
Conversation
size-limit report 📦
|
c293a03 to
05ad85e
Compare
more fixes moar fixes fixxx
Core's `getDynamicSamplingContext` now derives the DSC transaction name and handles the `url` source guard directly from the root span, making the OpenTelemetry-specific DSC enhancer redundant. Remove the util and its call sites in node, vercel-edge, and the otel test helper. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
With enhanceDscWithOpenTelemetryRootSpanName removed, the DSC for a continued remote trace is built by core's getDynamicSamplingContextFromSpan, which derives `sampled` from the root span's binary trace flags. That cannot tell a deferred sampling decision (which lives in the OTel trace state) apart from a definitive unsampled one — both read as `traceFlags: NONE` — so a deferred remote trace wrongly propagated `sentry-sampled=false`. Reconcile the span-derived DSC with the OTel sampling decision resolved by `getSamplingDecision` in the propagator's remote-span branch: drop `sampled` when deferred, and drop the transaction name when definitively unsampled (matching the OTel SDK, whose unsampled spans are nameless). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
reconcileDscSampled must only touch a DSC that core freshly derives from the span's binary trace flags. When a continued remote trace froze its own DSC on the trace state, getDynamicSamplingContextFromSpan returns it verbatim and the propagation spec treats it as immutable — reconciling would strip its `transaction` (on an unsampled trace) or rewrite `sampled`. This mirrors the old createDsc handler, which only ran on core's fresh-generate path and never saw a frozen DSC. Guard on the presence of an incoming `sentry.dsc` trace-state entry and skip reconciliation in that case. Adds a regression test for a directly-injected unsampled remote span with a frozen incoming DSC. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
b5eb299 to
baf73c5
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit baf73c5. Configure here.
| @@ -1,7 +1,5 @@ | |||
| export { getScopesFromContext } from './utils/contextData'; | |||
|
|
|||
| export { enhanceDscWithOpenTelemetryRootSpanName } from './utils/enhanceDscWithOpenTelemetryRootSpanName'; | |||
There was a problem hiding this comment.
Public API removed without migration docs
Medium Severity
enhanceDscWithOpenTelemetryRootSpanName was a public export of @sentry/opentelemetry and is removed here with no deprecation path and no entry under the @sentry/opentelemetry section in MIGRATION.md, where other public removals for that package are already listed. This violates the PR review rule on removal of publicly exported APIs / public API changes without proper deprecation notices. I flagged this because it was mentioned in the rules file.
Additional Locations (2)
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit baf73c5. Configure here.


Stacked on top of #22712.
With the span name/source inference reworked in #22712, core's
getDynamicSamplingContextnow derives the DSC transaction name from the root span and applies theurlsource guard itself. That makes the OpenTelemetry-specificcreateDschandlerenhanceDscWithOpenTelemetryRootSpanNameredundant — it was only there to re-derive the name/source viaparseSpanDescriptionbefore core did so natively.This removes the util along with its call sites in
@sentry/node,@sentry/vercel-edge, and the opentelemetry test helper, and drops it from the package's public exports.Since the enhancer is a public export of
@sentry/opentelemetry, its removal is technically breaking for anyone importing it directly — which is why this targets the breaking-change branch #22712.